<template>
  <div class="shelfcard-box" @click="handleToRead(id,chapter_id)">
    <van-image :src="image" class="shelfcard-img" fit="cover">
      <template v-slot:loading>
        <van-loading type="spinner" size="20" />
      </template>
    </van-image>
    <div class="shelfcard-name van-ellipsis">{{name}}</div>
    <div class="shelfcard-info van-ellipsis">
      <span class="shelfcard-over">{{is_over}}</span>
      <span>/</span>
      <span class="shelfcard-percentage">{{percentage}}</span>
    </div>
  </div>
</template>

<script>
import Taro from "@tarojs/taro";
export default {
  name: "ShelfCard",
  props: {
    name: String,
    is_over: String,
    percentage: String,
    id: { type: [String, Number] },
    chapter_id: { type: [String, Number] },
    image: {
      default: "http://foglake.sanye666.top/images/default-covor.jpg",
      type: String,
    },
  },
  methods: {
    handleToRead(id, chapter_id) {
      Taro.navigateTo({
        url: `/pages/read/read?id=${id}&chapter_id=${chapter_id}`,
      });
    },
  },
};
</script>

<style scoped>
.shelfcard-box {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  margin-bottom: 37px;
}
.shelfcard-img {
  width: 182px;
  height: 240px;
  border-radius: 12px;
  background-repeat: no-repeat;
}
.shelfcard-name {
  font-size: 24px;
  width: 182px;
  font-family: Alibaba PuHuiTi;
  font-weight: 600;
  color: rgba(6, 27, 65, 0.75);
  margin-top: 20px;
  margin-left: 8px;
}
.shelfcard-info {
  font-size: 20px;
  font-family: Alibaba PuHuiTi;
  font-weight: 400;
  color: rgba(6, 27, 65, 0.35);
  margin-left: 8px;
}
.shelfcard-over {
}
.shelfcard-percentage {
}
</style>